{% extends 'task_market/base.html' %}
{% load static %}


{% block title %}
    主页
{% endblock %}

{% block header %}

    <header class="header shop">

        <div class="topbar">
            <div class="container">
                <div class="row">
                    <div class="col-lg-6 col-md-12 col-12">

                        <div class="top-left">
                            <ul class="list-main">
                                <li><i class="ti-headphone-alt"></i> +86 15837204509</li>
                                <li><i class="ti-email"></i> 20377277@buaa.edu.cn</li>
                            </ul>
                        </div>

                    </div>
                    <div class="col-lg-6 col-md-12 col-12">

                        <div class="right-content">
                            <ul class="list-main">
                                <li><i class="ti-user"></i> <a href="{% url 'task_market:user_mng:self' %}" target="_blank">My account</a></li>
                                {% if staues == 'login' %}
                                    <li><i class="ti-power-off"></i><a href="{% url 'task_market:user_mng:log' %}">Login</a></li>
                                    <li><i class="ti-settings"></i><a href="{% url 'task_market:user_mng:signup' %}">Register</a></li>
                                {% else %}
                                    <li><i class="ti-power-off"></i><a href="{% url 'task_market:user_mng:log' %}">Logout</a></li>
                                {% endif %}
                                </li>
                            </ul>
                        </div>

                    </div>
                </div>
            </div>
        </div>

        <div class="middle-inner">
            <div class="container">
                <div class="row">
                    <div class="col-lg-3 col-md-3 col-12">

                        <div class="logo">
                            <a href="{% url 'task_market:index' %}"><img src="{% static 'temp_shop/assets/img/logo.png' %}" alt="logo"></a>
                        </div>


                        <div class="search-top">
                            <div class="top-search"><a href="#0"><i class="far fa-search"></i></a></div>

                            <div class="search-top">
                                <form class="search-form">
                                    <input type="text" placeholder="Search here..." name="search">
                                    <button value="search" type="submit"><i class="far fa-search"></i></button>
                                </form>
                            </div>

                        </div>

                        <div class="mobile-nav"></div>
                    </div>
                    <div class="col-lg-7 col-md-6 col-12">
                        <div class="search-bar-top">
                            <div class="search-bar">
                                <form>
                                    {% csrf_token %}
                                    <input name="search" placeholder="Search Here" type="search">
                                    <button class="btnn"><i class="far fa-search"></i></button>
                                </form>
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-2 col-md-3 col-12">
                        <div class="right-bar">
                            <div class="sinlge-bar">
                                <a class="single-icon"><i class="fal fa-user-circle" aria-hidden="true"></i></a>
                                <a href="{% url 'task_market:user_mng:login' %}" class="single-icon" style="font-size: 16px;"><span> 欢迎您, {{ name }}</span></a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="header-inner  shadow">
            <div class="container">
                <div class="cat-nav-head">
                    <div class="row">
                        <div class="col-lg-3">
                            <div class="all-category">
                                <div class="d-flex">
                                    <i class="flaticon-menu cat-heading-icon"></i>
                                    <a href="{% url 'task_market:index' %}"><h3 class="cat-heading">数据标注众包平台</h3></a>
                                </div>
                            </div>
                        </div>
                        <div class="col-lg-9 col-12">
                            <div class="menu-area">

                                <nav class="navbar navbar-expand-lg">
                                    <div class="navbar-collapse">
                                        <div class="nav-inner">
                                            <ul class="nav main-menu menu navbar-nav">
                                                <li><a href="{% url 'task_market:index' %}">Home</a></li>
                                                <li><a href="{% url 'task_market:user_mng:self' %}" target="_blank">Space</a></li>
                                                <li><a href="#">Task</a>
                                                    <ul class="dropdown">
                                                        <li><a href="{% url 'task_market:all_grid' %}" target="_blank">Task Grid</a></li>
                                                        <li><a href="{% url 'task_market:all_list' %}" target="_blank">Task List</a></li>
                                                    </ul>
                                                </li>
                                                <li><a href="{% url 'task_market:worker' %}">工人市场</a></li>
                                                <li><a href="{% url 'task_market:index' %}">质量审核</a></li>
                                                <li><a href="{% url 'task_market:index' %}">任务审核</a></li>
                                            </ul>
                                        </div>
                                    </div>
                                </nav>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </header>

{% endblock %}

{% block content %}

    <section class="hero-slider bg-grey">
        <div class="container">
            <div class="main-hero-slider owl-carousel owl-theme">

                <div class="item">
                    <div class="single-slider item">
                        <div class="row">
                            <div class="col-lg-7 col-md-8 my-auto">
                                <div class="text-inner">
                                    <div class="hero-text">
                                        <h1><span>UP TO 50% OFF </span>For Your First Buy</h1>
                                        <p>There are many variations of passages of lorem ipsum <br> available but the
                                            majority have suffered alteration in <br> some form by injected humour.</p>
                                        <div class="button">
                                            <a href="#" class="btn">Shop Now!</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-lg-5 col-md-4 my-auto">
                                <img src="{% static 'temp_shop/assets/img/happy.jpg' %}" class="w-100" alt="">
                            </div>
                        </div>
                    </div>
                </div>


                <div class="item">
                    <div class="single-slider item">
                        <div class="row">
                            <div class="col-lg-7 col-md-8 my-auto">
                                <div class="text-inner">
                                    <div class="hero-text">
                                        <h1><span>UP TO 50% OFF </span>For Your First Buy</h1>
                                        <p>There are many variations of passages of lorem ipsum <br> available but the
                                            majority have suffered alteration in <br> some form by injected humour.</p>
                                        <div class="button">
                                            <a href="#" class="btn">Shop Now!</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-lg-5 col-md-4 my-auto">
                                <img src="{% static 'temp_shop/assets/img/slider/slider-2.png' %}" class="w-100" alt="">
                            </div>
                        </div>
                    </div>
                </div>


                <div class="item">
                    <div class="single-slider item">
                        <div class="row">
                            <div class="col-lg-7 col-md-8  my-auto">
                                <div class="text-inner">
                                    <div class="hero-text">
                                        <h1><span>UP TO 50% OFF </span>For Your First Buy</h1>
                                        <p>There are many variations of passages of lorem ipsum <br> available but the
                                            majority have suffered alteration in <br> some form by injected humour.</p>
                                        <div class="button">
                                            <a href="#" class="btn">Shop Now!</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-lg-5 col-md-4 my-auto">
                                <img src="{% static 'temp_shop/assets/img/slider/slider-2.png' %}" class="w-100" alt="">
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </section>

    <div class="product-area section">
        <div class="container">
            <div class="row">
                <div class="col-12">
                    <div class="section-title d-flex justify-content-between align-center">
                        <div class="d-flex section-title-left">
                            <i class="flaticon-tags"></i>
                            <h2>任务信息</h2>
                        </div>
                        <div class="section-title-right">
                            <a href="{% url 'task_market:all_grid' %}" target="_blank">View More <i class="far fa-long-arrow-right"></i></a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="product-slider owl-carousel owl-theme">
                {% for task in tasks %}
                    <div class="item">
                        <div class="single-product">
                            <div class="product-img">
                                <a href="{% url 'task_market:details' id=task.id %}" target="_blank">
                                    <img class="product-img" src="{% static 'temp_shop/assets/img/slider/slider.png' %}"
                                         alt="#">
                                    <span class="new">{{ task.id }}</span>
                                </a>
                                <div class="button-head">
                                    <div class="product-action">
                                        <a data-bs-toggle="modal" data-bs-target="#staticBackdrop{{ task.id }}"
                                           href="#"><i class="far fa-eye"></i><span>Quick Shop</span></a>
                                    </div>
                                </div>
                            </div>
                            <div class="product-content">
                                <h3><a href="{% url 'task_market:details' id=task.id %}" target="_blank">{{ task.task_name }}</a></h3>
                                <div class="d-flex justify-content-between">
                                    <div class="product-price" style="color: red;">
                                        <span>任务等级：{{ task.task_rank }}</span>
                                    </div>
                                </div>
                                <div class="d-flex justify-content-between">
                                    <div class="product-price">
                                        <span>薪资标准：{{ task.task_salary }}元/条</span>
                                    </div>
                                    <button class="product-cart-btn" type="button"><a href="{% url 'task_market:task_apply' task_id=task.id %}">申请</a>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                {% endfor %}
            </div>
        </div>
    </div>

{% endblock %}

{% block view %}

    {% for task in tasks %}
        <div class="modal" id="staticBackdrop{{ task.id }}" data-bs-backdrop="static" data-bs-keyboard="false"
             tabindex="-1" aria-labelledby="staticBackdrop" aria-hidden="true">
            <div class="modal-dialog modal-lg modal-dialog-centered" role="document">
                <div class="modal-content">
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                    <div class="modal-body">
                        <div class="row">
                            <div class="col-lg-6 col-md-12 col-sm-12 col-xs-12">
                                <img src="{% static 'temp_shop/assets/img/products/p1.png' %}" alt="#">
                            </div>
                            <div class="col-lg-6 col-md-12 col-sm-12 col-xs-12">
                                <div class="quickview-content">
                                    <div class="d-flex mb-3"></div>
                                    <h2>{{ task.task_name }}</h2>
                                    <div class="d-flex mb-3">
                                        <span>任务描述：</span>
                                    </div>
                                    <div class="d-flex mb-3">
                                        <b>{{ task.task_description }}</b>
                                    </div>
                                    <div class="d-flex mb-3"></div>
                                    <div class="d-flex mb-3">
                                        <span>薪资标准：</span>
                                    </div>
                                    <h2>{{ task.task_salary }}元/条</h2>
                                    <div class="add-to-cart">
                                        <a href="{% url 'task_market:details' id=task.id %}" class="btn">详情信息</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    {% endfor %}

{% endblock %}